import { render } from "nprogress";

let xny =
  /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([A-HJ-K][A-HJ-NP-Z0-9][0-9]{4}$))/;
let ryc =
  /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
export default {
  goOutContent1: [
    { title: "入口收费站", dataIndex: "deptName",width:160 },
    { title: "上报时间", dataIndex: "reportDate",width:120 },
    // {
    //   title: "是否存在轴重异常车辆",
    //   dataIndex: "isAxesAbnormal",
    //   render: (text) => {
    //     if (text == "Y") return "是";
    //     if (text == "N") return "否";
    //   }
    //   ,width:200
    // },
    { title: "车牌", dataIndex: "vehicle",width:100 },
    { title: "车型", dataIndex: "vehicleType" },
    { title: "入口时间", dataIndex: "enTime",width:160 },
    { title: "入口重量", dataIndex: "enWeight",width:160 },
    { title: "限重", dataIndex: "maxWeight" },
    { title: "轴1", dataIndex: "axesOne" },
    { title: "轴2", dataIndex: "axesTwo" },
    { title: "轴3", dataIndex: "axesThree" },
    { title: "轴4", dataIndex: "axesFour" },
    { title: "轴5", dataIndex: "axesFive" },
    { title: "轴6", dataIndex: "axesSix" },

    { title: "车头照片", dataIndex: "headstockImg", isImg: true },
    { title: "车尾照片", dataIndex: "tailstockImg", isImg: true },
    { title: "右车尾照片", dataIndex: "leftBottomImg", isImg: true },
    { title: "左车尾照片", dataIndex: "rightBottomImg", isImg: true },

    { title: "当班治超员", dataIndex: "overhealer",width:160 },
    {
      title: "是否存在违法类型（液压顶轴、飞机轮、套牌等）",
      dataIndex: "isLaw",
      render: (text) => {
        if (text == "Y") return "是";
        if (text == "N") return "否";
      },
      width:220
    },
    {
      title: "是否驶入高速",
      dataIndex: "isIn",
      render: (text) => {
        if (text == "Y") return "是";
        if (text == "N") return "否";
      },
    },
   
     
    { title: "备注（是否移交上报）", dataIndex: "remark",width:160 },

    {
      title: "操作",
      key: "operation",
      dataIndex: "operation",
      width: 250,
      dispaly: true,
      slot: true,
      fixed: "right",
    },
  ],
  goOutContent2: [
    { title: "出口收费站", dataIndex: "deptName" },
    { title: "上报时间", dataIndex: "reportDate" },    
    { title: "统计时间", dataIndex: "statisticalTime", render: (text,data) => {
      return text?text+'-'+data.statisticalEndTime:'-'
    }, width:220},  
    { title: "检测拦截车辆数（辆）", dataIndex: "interceptVehicle" },
    {
      title: "向执法机构移交疑似超限车辆数（辆）",
      dataIndex: "handoverOfVehicle",
    },
    {
      title: "执法人员未到场放行疑似超限车辆数（辆）",
      dataIndex: "releaseVehicle",
      width:200
    },
    {
      title: "未向执法机构移交拦截车辆数（辆）",
      dataIndex: "undeliveredVehicle",
    },
    { title: "未向执法机构移交拦截车辆的原因", dataIndex: "reason" },
   
    {
      title: "操作",
      key: "operation",
      dataIndex: "operation",
      width: 250,
      dispaly: true,
      slot: true,
      fixed: "right",
    },
  ],
  goOutContent3: [
    // { title: "填报单位", dataIndex: "companyName" },
    // { title: "填报时间", dataIndex: "roadName" },
    { title: "出口收费站名称", dataIndex: "deptName",width:160 },
    { title: "上报时间", dataIndex: "reportDate",width:120 },    
    { title: "统计时间", dataIndex: "statisticalTime", render: (text,data) => {
      return text?text+'-'+data.statisticalEndTime:'-'
    },width:120},       
    { title: "车牌", dataIndex: "vehicle" },
    { title: "轴数", dataIndex: "axes" },
    { title: "检测时间", dataIndex: "checkTime",width:120  },
    { title: "车货总重（千克）", dataIndex: "cargoWeight",width:160 },
    { title: "最大允许总质量（千克）", dataIndex: "maxWeight",width:220 },
    { title: "超限重量（千克）", dataIndex: "transfiniteWeight",width:160 },
    { title: "超限率（%）", dataIndex: "overrunRate",width:120 },
    { title: "入口省份", dataIndex: "enProvince",width:100 },
    { title: "入口收费站名称", dataIndex: "enStation",width:160 },
    {
      title: "是否向执法部门移交",
      dataIndex: "isEnforcement",
      render: (text) => {
        if (text == "Y") return "是";
        if (text == "N") return "否";
      },
      width:180
    },
    { title: "原因", dataIndex: "reason" },
    
    {
      title: "操作",
      key: "operation",
      dataIndex: "operation",
      width: 250,
      dispaly: true,
      slot: true,
      fixed: "right",
    },
  ],

  formItemConfig1: [
    {
      label: "上报时间",
      prop: "reportDate",
      component: "date",
      clearable: true,
      type: "date",
      format: "YYYY-MM-DD",
      span: 12,
      width: "50%",
      labelWidth: 160,
    },

    {
      label: "入口收费站",
      prop: "enStation",
      component: "tree",
      placeholder: "请选择",
      span: 12,
      labelWidth: 160,
    },
    {
      label: "车牌号",
      prop: "vehicle",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 160,
      rules: [
        { required: true, message: "车牌号不能为空", trigger: "blur" },
        {
          validator: (rule, value, callback) => {
            if (!xny.test(value) && !ryc.test(value)) {
              callback(new Error("请输入正确的车牌号"));
            } else {
              callback();
            }
          },
          trigger: "blur",
        },
      ],
    },
    {
      label: "车型",
      prop: "vehicleType",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 160,
    },
    {
      label: "入口时间",
      prop: "enTime",
      component: "date",
      clearable: true,
      span: 12,
      width: "50%",
      labelWidth: 160,
    },

    {
      label: "入口重量",
      prop: "enWeight",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 160,
    },
    {
      label: "限重",
      prop: "maxWeight",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 160,
    },
    {
      label: "轴1",
      prop: "axesOne",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 160,
    },
    {
      label: "轴2",
      prop: "axesTwo",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 160,
    },
    {
      label: "轴3",
      prop: "axesThree",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 160,
    },
    {
      label: "轴4",
      prop: "axesFour",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 160,
    },
    {
      label: "轴5",
      prop: "axesFive",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 160,
    },
    {
      label: "轴6",
      prop: "axesSix",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 160,
    },

    {
      label: "当班治超员",
      prop: "overhealer",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 160,
    },
    {
      label: "是否存在违法类型",
      prop: "isLaw",
      component: "select",
      placeholder: "请选择",
      span: 12,
      labelWidth: 160,
    },
    {
      label: "是否驶入高速",
      prop: "isIn",
      component: "select",
      placeholder: "请选择",
      span: 12,
      labelWidth: 160,
    },
    {
      label: "是否向执法部门移交",
      prop: "isEnforcement",
      component: "select",
      placeholder: "请选择",
      span: 12,
      labelWidth: 160,
    },
    // {
    //   label: "是否存在轴重异常车辆",
    //   prop: "isAxesAbnormal",
    //   component: "select",
    //   placeholder: "请选择",
    //   span: 12,
    //   labelWidth: 160,
    // },
    {
      label: "车头照片",
      prop: "headstockImg",
      component: "img",
      placeholder: "请输入",
      span: 12,
      labelWidth: 160,
    },
    {
      label: "车尾照片",
      prop: "tailstockImg",
      component: "img",
      placeholder: "请输入",
      span: 12,
      labelWidth: 160,
    },
    {
      label: "左车底照片",
      prop: "leftBottomImg",
      component: "img",
      placeholder: "请输入",
      span: 12,
      labelWidth: 160,
    },
    {
      label: "右车底照片",
      prop: "rightBottomImg",
      component: "img",
      placeholder: "请输入",
      span: 12,
      labelWidth: 160,
    },
  ],
  formItemConfig2: [
    {
      label: "上报时间",
      prop: "reportDate",
      component: "date",
      clearable: true,
      type: "date",
      format: "YYYY-MM-DD",
      span: 24,
      labelWidth: "250px",
    },
    {
      label: "统计时间",
      prop: "statistical",
      component: "date",
      clearable: true,
      type: "daterange",
      format: "YYYY-MM-DD",
      span: 24,
      labelWidth: "250px",
    },    
    {
      label: "出口收费站",
      prop: "exStation",
      component: "tree",
      placeholder: "请选择",
      span: 24,
      labelWidth: "250px",
    },
    {
      label: "检测拦截车辆数",
      prop: "interceptVehicle",
      component: "input",
      placeholder: "请输入",
      span: 24,
      labelWidth: "250px",
    },
    {
      label: "向执法机构移交疑似超限车辆数",
      prop: "handoverOfVehicle",
      component: "input",
      placeholder: "请输入",
      span: 24,
      labelWidth: "250px",
    },
    {
      label: "执法人员未到场放行疑似超限车辆数",
      prop: "releaseVehicle",
      component: "input",
      placeholder: "请输入",
      span: 24,
      labelWidth: "250px",
    },
    {
      label: "未向执法机构移交拦截车辆数",
      prop: "undeliveredVehicle",
      component: "input",
      placeholder: "请输入",
      span: 24,
      labelWidth: "250px",
    },
    {
      label: "未向执法机构移交拦截车辆的原因",
      prop: "reason",
      component: "textarea",
      placeholder: "请输入",
      span: 24,
      labelWidth: "250px",
    },
  ],
  formItemConfig3: [
    {
      label: "上报时间",
      prop: "reportDate",
      component: "date",
      clearable: true,
      type: "date",
      format: "YYYY-MM-DD",
      span: 12,
      width: "50%",
      labelWidth: 140,
    },
    {
      label: "统计时间",
      prop: "statistical",
      component: "date",
      clearable: true,
      type: "daterange",
      format: "YYYY-MM-DD",
      span: 12,
      labelWidth: 140,
    },    
    {
      label: "出口收费站",
      prop: "exStation",
      component: "tree",
      placeholder: "请选择",
      span: 12,
      labelWidth: 140,
    },
    {
      label: "车牌",
      prop: "vehicle",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 140,
      rules: [
        { required: true, message: "车牌号不能为空", trigger: "blur" },
        {
          validator: (rule, value, callback) => {
            if (!xny.test(value) && !ryc.test(value)) {
              callback(new Error("请输入正确的车牌号"));
            } else {
              callback();
            }
          },
          trigger: "blur",
        },
      ],
    },

    {
      label: "轴数",
      prop: "axes",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 140,
    },
    {
      label: "检测时间",
      prop: "checkTime",
      component: "date",
      clearable: true,
      type: "datetime",
      format: "YYYY-MM-DD HH:mm:ss'",
      span: 12,
      width: "50%",
      labelWidth: 140,
    },
    {
      label: "车货总重",
      prop: "cargoWeight",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 140,
      append:"Kg"
    },
    {
      label: "最大允许总质量",
      prop: "maxWeight",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 140,
      append:"Kg"
    },

    {
      label: "超限重量",
      prop: "transfiniteWeight",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 140,
      append:"Kg"

    },
    {
      label: "超限率",
      prop: "overrunRate",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 140,
    },
    {
      label: "入口省份",
      prop: "enProvince",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 140,
    },
    {
      label: "入口收费站",
      prop: "enStation",
      component: "input",
      placeholder: "请输入",
      span: 12,
      labelWidth: 140,
    },
    {
      label: "是否向执法部门移交",
      prop: "isEnforcement",
      component: "select",
      placeholder: "请选择",
      span: 12,
      labelWidth: 140,
    },
    {
      label: "原因",
      prop: "reason",
      component: "textarea",
      placeholder: "请输入",
      span: 24,
      labelWidth: 140,
    },
  ],
  rules: {
    vehicle: [
      { required: false, message: "车牌号不能为空", trigger: "blur" },
      {
        validator: (rule, value, callback) => {
          
          if(!value){
            callback();
          }else if (!xny.test(value) && !ryc.test(value)) {
            callback(new Error("请输入正确的车牌号"));
          }  else {
            callback();
          }
        },
        trigger: "blur",
      },
    ],
  },
};
